package com.dcjt.firehotcarpad.adapter

import android.annotation.SuppressLint
import android.app.Activity
import com.allen.library.SuperTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dcjt.firehotcarpad.R
import com.dcjt.firehotcarpad.entity.JjdItem
import com.dcjt.firehotcarpad.utils.StringUtils

/**
 * 集结点选择
 */
class JjdPopwindowAdapter(context: Activity, data: List<JjdItem>?)
    : BaseQuickAdapter<JjdItem, BaseViewHolder>(R.layout.item_jjd_pop, data) {
    private var onClickLisenter: OnJjdClickLisenter? = null


    @SuppressLint("ResourceAsColor")
    override fun convert(helper: BaseViewHolder?, item: JjdItem?) {
        var stv_jjd_view = helper?.getView<SuperTextView>(R.id.stv_jjd)
        stv_jjd_view?.setCenterString(item?.mc)
        stv_jjd_view?.setOnSuperTextViewClickListener {
            if (onClickLisenter!= null){
                item?.let { it1 ->
                    if (helper != null) {
                        onClickLisenter!!.setOnclick(it1,helper.adapterPosition)
                    }
                }
            }
        }
    }
    public fun setOnJjdClick(onClick: OnJjdClickLisenter) {
        this.onClickLisenter = onClick
    }

}

interface OnJjdClickLisenter{
    fun setOnclick(data:JjdItem,position:Int)
}
